package com.vodone.v1pin.video.delegate
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.model.MainModelLocator;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	
	import mx.rpc.http.mxml.HTTPService;
	public class VideoDelegate
	{
		public static function getVideoList( resultHandler:Function , pageIndex:int = 1, pageSize:int = 5 , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getVideoList;
			var params:Object = {
				pageIndex : pageIndex,
				pageSize : pageSize
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function getRecommandVideoList( resultHandler:Function , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getRecommandVideoList;
			var params:Object = {
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function getReplyVideoList( resultHandler:Function , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getReplyVideoList;
			var params:Object = {
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		/**
		 * 获取条件 
		 * @param resultHandler
		 * @param faultHandler
		 * @param context
		 * 
		 */		
		public static function getReplyVideoCondition( resultHandler:Function , sex:String = "" , cid:String = "", pid:String = "" , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getReplyMoreCondition;
			var params:Object = {
				sexsign:sex,
				cid:cid,
				bid:pid
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		/**
		 * 获取精彩列表 
		 * @param resultHandler
		 * @param faultHandler
		 * @param context
		 * 
		 */		
		public static function getReplyMoreVideoList( resultHandler:Function , start:Number = 0, end:Number = 0, sex:String = null, procategory:String = null, probrand:String = null, faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getReplyMoreVideoList;
			var params:Object = {
				time1 : start,
				time2 : end,
				sexsign : sex,
				procategory : procategory,
				probrand : probrand
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		/**
		 * 获取秒杀商品列表
		 * */
		public static function getMiaoShaVideoList( resultHandler:Function , videoid:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getMiaoShaVideoList;
			var params:Object = {
				videoid : videoid
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		/**
		 * 获取用户购买信息
		 */		
		public static function getUserBuyInfoList( resultHandler:Function , videoid:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getUserBuyInfoList;
			var params:Object = {
				videoid : videoid
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		/**
		 * 验证秒杀商品是否存在存库 
		 */		
		public static function checkMiaoShaProduct( resultHandler:Function , proCode:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().checkMiaoShaProduct;
			var params:Object = {
				proCode : proCode
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		
	}
}